package cn.lopr.im.api.bean;

public class Message {
    public enum MessageType {
        USER_ONLINE(0, "用户上线"),
        SEND_TO_USER(1, "发送给用户"),
        SEND_TO_GROUP(2, "发送给组"),
        SEND_ADD(3, "发送添加好友信息");

        private final int code;
        private final String desc;

        MessageType(int code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public int getCode() {
            return code;
        }

        public String getDesc() {
            return desc;
        }

        public static MessageType getTypeByCode(int code) {
            for (MessageType value : values()) {
                if (value.getCode() == code) {
                    return value;
                }
            }

            return null;
        }
    }

    private Integer id;

    private String type;

    private String fromUser;

    private String toUser;

    private String date;

    private String msg;

    private String groupId;

    private Integer isRead;

    public Integer getId() {
        return id;
    }

    public Message setId(Integer id) {
        this.id = id;
        return this;
    }

    public String getType() {
        return type;
    }

    public Message setType(String type) {
        this.type = type == null ? null : type.trim();
        return this;
    }

    public String getFromUser() {
        return fromUser;
    }

    public Message setFromUser(String fromUser) {
        this.fromUser = fromUser == null ? null : fromUser.trim();
        return this;
    }

    public String getToUser() {
        return toUser;
    }

    public Message setToUser(String toUser) {
        this.toUser = toUser == null ? null : toUser.trim();
        return this;
    }

    public String getDate() {
        return date;
    }

    public Message setDate(String date) {
        this.date = date == null ? null : date.trim();
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public Message setMsg(String msg) {
        this.msg = msg == null ? null : msg.trim();
        return this;
    }

    public String getGroupId() {
        return groupId;
    }

    public Message setGroupId(String groupId) {
        this.groupId = groupId == null ? null : groupId.trim();
        return this;
    }

    public Integer getIsRead() {
        return isRead;
    }

    public Message setIsRead(Integer isRead) {
        this.isRead = isRead;
        return this;
    }
}